$(function(){
	$(":submit[name='login']").click(function(){
		var username = $(":text[name='username']").val();
		var password = $("input[name='password']").val();
		if($.trim(username)=="" || $.trim(password)==""){
			alert("请输入验证码");
		}else{
            $.ajax({
                url: module_url+"/dologin.do",	                
                type:'post',
    			dataType:"json",
    			data: "username="+username+"&password="+password,
            	success:function(json){
    				if(json.err_code==-1){
    					alert(json.err_msg);
    					window.location.href=app_url+'/userCenter/index.do';
    				}else{
    					alert(json.err_msg);
    				}
    			},
                error: function () { alert("登录失败") }
            });
		}	
		return false;
 	           
	});
});